import { stringify } from 'qs';
import request from '@/utils/request';

//部门详情查询
export async function deptDetails (params) {
  let url = `/iot/dmp/v1/depts/${params}`;
  return request(url, {
    method: 'GET',
  });
}

//修改节点信息
export async function editForm (params) {

  let url = `/iot/dmp/v1/depts/update/${params.values.dept_id}`
  return request(url, {
    method: 'POST',
    body: 
      params.values
    
  });

}


//新增节点
export async function addBegin (params) {
  let url = '/iot/dmp/v1/depts/create'
  return request(url, {
    method: 'POST',
    body: {
      ...params
    },
  });
}

//删除节点
export async function deleteMothed (params) {
  let url = `/iot/dmp/v1/depts/delete/${params.dept_id}`
  return request(url, {
    method: 'GET',
  });
}

//查询“所属租户”的选项
export async function findAll (params) {

  let url = `/iot/dmp/v1/tenants/alllist`
  return request(url, {
    method: 'POST'}
  );
}


//查询“组织机构”的树 组织机构根据租户查询
export async function deptsTree (params) {

  let url = `/iot/dmp/v1/depts/tree`
  return request(url, {
    method: 'POST',
    body: {
      tenant_id: params.tenant_id
    }
  }
  );
}


